<template> 
  <div>  
     <div>  
        <p>超级企业列表</p>  
        <div> <button @click="businesssearch_btn()">搜索</button><input type="text" v-model="in_search"> <button>+</button></div>  
        <div class="roll">   
            <ul v-for="item in business_arr" :key="item.id">  
                <li @click="businessdetails_btn(item.id)">{{ item.ename }}</li>   
            </ul>  
        </div>  
        <div> 
            <div>  
               <span>新增超级企业</span>  
               <button>X</button> 
            </div>  
            <div>  
                超级企业名称：<input type="text" v-model="ename"><br>  
                企业域名：<input type="text" v-model="ipstr"><br> 
                超级管理员账号：<input type="text" v-model="adminname"><br>  
                邮箱：<input type="text" v-model="adminemil"><br>  
                最大坐席数：<input type="text" v-model="maxnum"><br>  
                最大登录并发总数：<input type="text" v-model="maxconcurrency">  
            </div>
            <div>
                <button>取消</button><button @click="businessadd_btn()">保存</button>
            </div>
        </div>
        <div>
            <button>停用超级企业</button>
        </div>  
     </div>  
  </div>  
</template> 
<script>
import { business_add, business_details, business_fun, business_search } from '@/utlis/https';  

  
export default {  
//   name:'',  
  data() {  
    return {  
        business_arr:[],
        ename:'',
        ipstr:'',  
        adminname:'',
        adminemil:'',
        maxnum:'',
        maxconcurrency:'',
        in_search:''
    }  
  },   
  mounted() {   
     this.business_list()  
  },  
  methods: {  
     business_list(){  
         business_fun()   
         .then(val=>{   
          console.log(val)   
        // this.verify_num = val.msg
        this.business_arr = val.data.data
        })       
        .catch(e=>{     
          console.log(e)    
        })
     },
     businessadd_btn(){
        business_add({
            ename:this.ename,
            ipstr:this.ipstr,  
            adminname:this.adminname,
            adminemil:this.adminemil,
            maxnum:this.maxnum,
            maxconcurrency:this.maxconcurrency           
        })            
        .then(val=>{   
          console.log(val)   
        // this.verify_num = val.msg       
        // this.business_arr = val.data.data      
        this.business_list()     
        })       
        .catch(e=>{     
          console.log(e)     
        }) 
     },         
     businessdetails_btn(i){  
          business_details({  
            id:i  
          })  
          .then(val=>{   
          console.log(val)    
        // this.verify_num = val.msg  
        // this.business_arr = val.data.data   
        // this.business_list()  
        })       
        .catch(e=>{     
          console.log(e)    
        })       
     },     
     businesssearch_btn(){    
        business_search({     
           ename:this.in_search     
        })    
        .then(val=>{   
          console.log(val)    
        // this.verify_num = val.msg  
        this.business_arr = val.data.data   
        // this.business_list()  
        })       
        .catch(e=>{     
          console.log(e)    
        })       
     }      
     
  },
}
</script>
<style lang='less' scoped>
    .roll{
    width: 200px;       
    height: 500px;      
    overflow: auto;     
    border: 1px solid #ccc;
    }
</style>